package com.zzyl.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.zzyl.dto.NursingProjectPlanDto;
import com.zzyl.entity.NursingProjectPlan;
import com.zzyl.mapper.NursingProjectPlanMapper;
import com.zzyl.service.NursingProjectPlanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @Description NursingProjectpalnServiceImpl
 * @Author LiShunSen
 * @Date 2024-08-28
 */
@Service
public class NursingProjectPlanServiceImpl implements NursingProjectPlanService {
    @Autowired
    private NursingProjectPlanMapper nursingProjectPlanMapper;

    @Override
    public int addList(List<NursingProjectPlanDto> projectPlans) {
     /*   List<NursingProjectPlan> projectPlanList = projectPlans.stream().map(
                v -> BeanUtil.toBean(v, NursingProjectPlan.class
                )).collect(Collectors.toList());
*/
        List<NursingProjectPlan> projectPlanList=BeanUtil.copyToList(projectPlans,NursingProjectPlan.class);
        return nursingProjectPlanMapper.addProjectId(projectPlanList);
    }

    @Override
    public int deletList(List<Long> ids) {

        return nursingProjectPlanMapper.deletList(ids);

    }
}
